package com.huawang.mdesign.model.service.util.reqif;

import com.huawang.mdesign.model.service.util.reqif.ref.RelationGroupTypeRef;
import com.huawang.mdesign.model.service.util.reqif.ref.SpecRelationRef;
import com.huawang.mdesign.model.service.util.reqif.ref.SpecificationRef;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * Represents a group of relations.
 *
 * @author xdl
 * @since 2023-04-04
 */
@Getter
@Setter
@XStreamAlias(ReqIFConstants.RELATION_GROUP)
public class RelationGroup extends AbstractSpecElementWithAttributes {

    /**
     * Points to the grouped SpecRelations.
     */
    @XStreamOmitField
    private List<SpecRelation> specRelations = new ArrayList<>();

    @XStreamAlias(ReqIFConstants.SPEC_RELATIONS)
    private List<SpecRelationRef> specRelationsRef = new ArrayList<>();

    /**
     * Linkage to the concrete SpecType instance.
     */
    @XStreamOmitField
    private RelationGroupType type;

    @XStreamAlias(ReqIFConstants.TYPE)
    private RelationGroupTypeRef typeRef;

    /**
     * Reference to the specification that contains SpecObject instances that are source objects of the relations
     * (referred to by the specRelations association).
     */
    @XStreamOmitField
    private Specification sourceSpecification;

    @XStreamAlias(ReqIFConstants.SOURCE_SPECIFICATION)
    private List<SpecificationRef> sourceSpecificationRef = new ArrayList<>();

    /**
     * Reference to the specification that contains SpecObject instances that are target objects of the relations
     * (referred to by the specRelations association).
     */
    @XStreamOmitField
    private Specification targetSpecification;

    @XStreamAlias(ReqIFConstants.TARGET_SPECIFICATION)
    private List<SpecificationRef> targetSpecificationRef = new ArrayList<>();

    /**
     * The back linkage to the owning ReqIFContent element.
     */
    @XStreamOmitField
    private ReqIFContent coreContent;
}
